// 实现简单的继承

class Pay {
  money: number
  constructor(money: number) {
    this.money = money
  }
  pay() { console.log("Pay类的pay方法被调用") }
}

enum PayType { WechatPay = "wechatPay", Alipay = "alipay" }

class MobilePay extends Pay {
  appName: string
  payType: string
  constructor(money: number, appName: string, payType: PayType) {
    super(money)
    this.appName = appName
    this.payType = payType
  }
  // 重写父类的pay
  pay() {
    super.pay()
    // 父类的方法无法实现全部功能，则由子类重写
    console.log("很多的JS操作")
  }
}

class Man {
  showPayType(pay: Pay) {
    pay.pay()
  }
}

const mobilePay = new MobilePay(100, '微信', PayType.WechatPay)
mobilePay.pay()
console.log('mobilePay', mobilePay)

const man = new Man()
man.showPayType(mobilePay)

export {}